#ifndef TCP_SERVER_H
#define TCP_SERVER_H
#include<netinet/in.h>    
#include<sys/socket.h>    
#include<unistd.h>   
    
#include<stdio.h>    
#include<string.h>    
#include<iostream>    
#include<event.h>    
#include<event2/listener.h>    
#include<event2/bufferevent.h>    
#include<event2/thread.h>

#include "common.h"
//const char* stateCode[14] = {"S00","S01","S02","S03","S04","E00","E01","E02","E03","E04","E05","E06","E07","E08"};
struct InterFaceInfo{
	char server[20] = "information";
	int status = 0;
	int locaSignal = 1;
	int battery = 0;
	int current = 0;
	int tem = 30;
	int batteryCapacity = 30;
	int taskClass = 0;
	int slot = 0;
	int lX = 20;
	int lY = 15;
	int begin = 0;
	char headControl = 'n';
};

void listener_cb(evconnlistener *listener, evutil_socket_t fd,    
                 struct sockaddr *sock, int socklen, void *arg);    
    
void socket_read_cb(bufferevent *bev, void *arg);    
void socket_event_cb(bufferevent *bev, short events, void *arg);    
void socket_info();
#endif
